package com.jlastu.dlxy_androidapp.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.jlastu.dlxy_androidapp.R;
import com.jlastu.dlxy_androidapp.entity.OrderItem;

import java.util.List;

public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderViewHolder> {

    private List<OrderItem> mOrderItems;

    public OrderAdapter(List<OrderItem> orderItems) {
        mOrderItems = orderItems;
    }

    @NonNull
    @Override
    public OrderViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.order_item_layout, parent, false);
        return new OrderViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(@NonNull OrderViewHolder holder, int position) {
        OrderItem item = mOrderItems.get(position);
        // 绑定数据到ViewHolder
    }

    @Override
    public int getItemCount() {
        return mOrderItems.size();
    }

    static class OrderViewHolder extends RecyclerView.ViewHolder {
        public OrderViewHolder(View itemView) {
            super(itemView);
        }
        // ViewHolder的实现，绑定View
    }
}